package com.android.kotlincoroutinemvvmdemo.contentprovider

import android.content.Context
import android.database.ContentObserver
import android.net.Uri
import android.os.Handler
import android.util.Log

class DBContentObserver(context: Context, mHandler: Handler) : ContentObserver(mHandler) {

    private val mContext = context

    private var dataType: String = ""

    override fun deliverSelfNotifications() = true

    override fun onChange(selfChange: Boolean, uri: Uri?) {
        super.onChange(selfChange, uri)
        Log.d("DBContentObserver", "override fun onChange(selfChange: Boolean, uri: Uri?)")
    }


    fun updateDataType(dataType: String) {
        this.dataType = dataType
    }

    companion object {
        const val TABLE_GESTURE_INSERT = "gesture/insert/0"
        const val TABLE_GESTURE_UPDATE_DIR = "gesture/update/0"
        const val TABLE_GESTURE_UPDATE_ITEM = "gesture/update/1"
        const val TABLE_GESTURE_DELETE_DIR = "gesture/delete/0"
        const val TABLE_GESTURE_DELETE_ITEM = "gesture/delete/1"

        const val TABLE_STUDENT_INSERT = "student/insert/0"
        const val TABLE_STUDENT_UPDATE_DIR = "student/update/0"
        const val TABLE_STUDENT_UPDATE_ITEM = "student/update/1"
        const val TABLE_STUDENT_DELETE_DIR = "student/delete/0"
        const val TABLE_STUDENT_DELETE_ITEM = "student/delete/1"
    }
}